<template>
    <el-col >
    <el-menu
      :default-active="$store.state.menu_active.toString()"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      @select="handleSelect"
      :collapse="this.$store.state.isCollapse">
      <el-menu-item index="1">
        <i class="el-icon-s-cooperation"></i>
        <span slot="title">工作台</span>
      </el-menu-item>
      <el-menu-item index="2">
        <i class="el-icon-s-data"></i>
        <span slot="title">数据统计</span>
      </el-menu-item>
      <el-menu-item index="3">
        <i class="el-icon-s-order"></i>
        <span slot="title">订单管理</span>
      </el-menu-item>
      <el-menu-item index="4">
        <i class="el-icon-burger"></i>
        <span slot="title">商品管理</span>
      </el-menu-item>
      <el-menu-item index="10">
        <i class="el-icon-box"></i>
        <span slot="title">库存管理</span>
      </el-menu-item>
      <el-menu-item index="5">
        <i class="el-icon-menu"></i>
        <span slot="title">分类管理</span>
      </el-menu-item>
      <el-menu-item index="6">
        <i class="el-icon-s-custom"></i>
        <span slot="title">员工管理</span>
      </el-menu-item>
      <el-menu-item index="12">
        <i class="el-icon-medal"></i>
        <span slot="title">会员管理</span>
      </el-menu-item>
      <el-menu-item index="7">
        <i class="el-icon-s-shop"></i>
        <span slot="title">商店管理</span>
      </el-menu-item>
      <el-menu-item index="8">
        <i class="el-icon-house"></i>
        <span slot="title">商店信息</span>
      </el-menu-item>
      <el-menu-item index="9">
        <i class="el-icon-user-solid"></i>
        <span slot="title">个人中心</span>
      </el-menu-item>
      <el-menu-item index="11">
        <i class="el-icon-shopping-cart-2"></i>
        <span slot="title">购买页面</span>
      </el-menu-item>
      <!-- <button @click="isCollapse = !isCollapse ">
        展开
      </button> -->
    </el-menu>
  </el-col>
</template>

<script>
export default {
    data() {
      return {
        // isCollapse:this.$store.state.isCollapse
      }
    },
    watch:{

    },
    created(){
        // console.log(this.isCollapse)
    },
    methods: {
      handleSelect(key,keyPath){
        console.log(key, keyPath);
        switch(key){
            case '1':
              this.$router.push('/home/workspace');
              this.$store.state.menu_active = 1;
              break;
            case '2':
              this.$router.push('/home/statistic');
              this.$store.state.menu_active = 2;
              break;
            case '3':
              this.$router.push('/home/order');
              this.$store.state.menu_active = 3;
              break;
            case '4':
              this.$router.push('/home/product');
              this.$store.state.menu_active = 4;
              break;
            case '5':
              this.$router.push('/home/category');
              this.$store.state.menu_active = 5;
              break;
            case '6':
              this.$router.push('/home/user');
              this.$store.state.menu_active = 6;
              break;
            case '7':
              this.$router.push('/home/store');
              this.$store.state.menu_active = 7;
              break;
            case '8':
              this.$router.push('/home/storeInfo');
              this.$store.state.menu_active = 8;
              break;
            case '9':
              this.$router.push('/home/userInfo');
              this.$store.state.menu_active = 9;
              break;
            case '10':
              this.$router.push('/home/inventory');
              this.$store.state.menu_active = 10;
              break;
            case '11':
              this.$router.push('/home/purchase');
              this.$store.state.menu_active = 11;
              break;
            case '12':
              this.$router.push('/home/vip');
              this.$store.state.menu_active = 12;
              break;
            default:
              this.$store.state.menu_active = 1;
              console.log('default:'+key)
              break;
        }
      },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }

}
</script>

<style scoped>
    /* .el-menu-vertical-demo{
        background-color: #D3DCE6
        
    } */

    /* .el-menu-item{
      color: #ffffff;
    } */

.el-menu-vertical-demo:not(.el-menu--collapse) {
  background-color: #D3DCE6;
  
  /* background-color: #323232; */
  width: 200px;
  min-height: 360px;
  }

  .el-menu--collapse{
    background-color: #D3DCE6;
    /* background-color: #323232; */
  }
</style>